package org.example.config;

import com.alipay.api.AlipayClient;
import com.alipay.api.DefaultAlipayClient;

public class AlipayConfig {

    /**
     * 网关
     */
    public static final String URL = "https://openapi.alipaydev.com/gateway.do";

    /**
     * 支付宝APPID
     */
    public static final String APPID = "2021000116698258";

    /**
     * 应用私钥
     */
    public static final String APP_PRI_KEY = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCyXuaSsYr09gA3uQGGF4nmWIqDBxwzZph7jIdfRThED1yY4v5YDgx5GFfCLEQO/o94DSEl8rDJAuwtWV7XGJ1Q4fLjy5nv0xwAQHmHJCUlBw1NcReAWgiAnvJsPmVqkFfITCFHeYvM+ocB38zbZnz1XvwQ4AK7ib0C64PP8njFWuBBvUrcRnz2PGWtdY6qaKrOsiRYg+ZzHkWm23dnaAiWAPxzm8SoaMGJchMH7Gh1o3f9SpLYKbZ5ZpsUQDqWtg3V0XLkfUOkgjeieO9VtmzIyd93KCoyE2iUefGEwU3/veRPeki8wtlOxQ4Gk95CIj/oKasOPxjJXr0Mn7GOGT8/AgMBAAECggEATnlkFcvYp7cHF3zkh7sZZ2cy4TyikpajpU+JS0fn3kGn6neLkO/1Wt1z1rCk7LfgJOAZ4lkon/cSM01rZVSl+ay+sKuluRZ27kFvdh5X3TeCCb0kqspxjSzg2PCGq+B/Tlb4GTsHX5IlDZUJyskHVuiIG2CCs0GBD6TQJA+4RJLdCzQIBEhEz0Td0Ex4KRJPqQfYMwmWFfYsDu9tOmvl9PUJczAwMADk9mIeRgBvWqMGTG2WSnj1JxlgTpMhKofKm7h1zG8cDMxB0q7vApEc/++N42ADnQ27z2jFgfU+ac3Cq7UysJGx87goihv3MA1g0d2/jjITTCB65vxGkLQtkQKBgQD8dhePC9WRncMYMiYZCKRyZANqGoRhs9wIYr0VpOROAeJAdfQoVvscfzzTrEh272n/pJajV67H4o1Z2ZL/MdU1xhwRVZZmr2GyHjcWJ1EIRtP9VSzWvIIBztAqZet0xDcu/8wSCFWyOWBzPClwpGmnEe/njyPO9dFUXJnuvBL5WQKBgQC03vL1cXQ9OGgjreGLuemTVOzZjvcMElWoKjTO3OIbMG4NnGH6+zKOoKXytPsKXcdRKSP/Do4hj7trMMFafYanG8Pkp0QMwKIi60UuPCFeJCSfWQEGuEwc+JGOstiCRiJ9bu9MzlS/1E1ZV+J7yU+ANIDwyY7SnnNk395KTQhSVwKBgQC2UBV9QJ+PE62SqIxooZwX22+3zMRyxe8MwzknCzevuZ6IzGVwSDf5AU2M0qpV8VjLuzDpbmWShWFsVDnaPkNpHNKiFfuR1e8oMLe5MNVMs9Fc7Yh+3gzIf3BGXemmHhh3wVO+ZfR0ywiCzxxh8uk1NDfaMb07NLthP6oOBBVzqQKBgB5O9duXRWk02I6SBqeJYdCkfIQAZvmI4P2rBOpdLS5tMSPqvqh2C4TG+sfu99pG2K2K/VMyNzL8iOVvaBcnzbaW+n6IYOjaJtE/J3qV7Ol/mPtyyK89ltOL+6gz5AAAjKsEOele8eirRMLh7TvdAgtzwN+YhuxYTPHsaa19txVFAoGBAIV90Ol0woKezCMPOGWNfjuS9nzI7i6Xwcn8UEF8p6CSM90jRELxzUMPb9Ssc5dmIsivPtFWbTl68901a3NtCQ3Es3BzRsd6/bkNZGFXUwdfOSVynIkeXxHcE39BzJtr0pjeWcBAAS5uYleyA10nsG5TIIy1U1Qe7VzsIXbqdypL";

    /**
     * 参数返回格式
     */
    public static final String FORMAT = "JSON";

    /**
     * 字符编码
     */
    public static final String CHARSET = "UTF-8";

    /**
     * 签名类型
     */
    public static final String SIGN_TYPE = "RSA2";

    /**
     * 支付宝公钥
     */
    public static final String ALIPAY_PUBLIC_KEY = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArYRWeqSxMli5+e7nBAWmvsjEy7pjQkHtY/NgDsfd60nGzikbX3c8lGlAbnu3jnOmktSanbPAAj6DYByhH2u4HCjm2q9+KUbrLYmZJAdYHvhVgGuMd/+LY7ITAM+kCauMlydg5dTHpJ3tF8a0S/0+V4tnaaTPj+VwBjqnUn6b7fsECcPNbENXPQCYnB6xFwLGnN/C+/hZiEYBL+Rb1nVMJf+WDNWorJeyTIcMKEsXMkdLXbWyrTKc7Wrs0BEqWxdgOYRlLPUVLmOXNcUhCbhDNN8PwVsMBl8UwiUDPfyjc5gpDvLShli8/yiXgYsUFQUdj9AVf+o9ZZOtNpiVDGZjuQIDAQAB";

    /**
     * 配置不能new
     */
    private AlipayConfig() {

    }

    /**
     * 单例模式
     */
    public volatile static AlipayClient instance = null;

    public static AlipayClient getInstance() {
        if (instance == null) {
            synchronized (AlipayConfig.class) {
                if (instance == null) {
                    instance = new DefaultAlipayClient(URL, APPID, APP_PRI_KEY, FORMAT, CHARSET, ALIPAY_PUBLIC_KEY, SIGN_TYPE);
                }
            }
        }
        return instance;
    }

}
